package no.group.gowther.service.dto.param;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import no.group.gowther.util.JsonUtils;

import java.util.Collections;
import java.util.List;

/**
 * @author ayatsuji
 * @date 2022-04-26 22:54
 * @since
 */
public class OnePieceFilingDetailQueryDTO extends FilingDetailQueryDTO {
    private List<String> type;
    private List<Long> tagId;

    public static boolean isMine(JsonNode param) {
        return param.get("type") != null;
    }

    public static OnePieceFilingDetailQueryDTO getInstance(JsonNode param) {
        try {
            return JsonUtils.toPOJO(param.toString(), OnePieceFilingDetailQueryDTO.class);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return new OnePieceFilingDetailQueryDTO();
    }

    public List<String> getType() {
        return type == null ? Collections.emptyList() : type;
    }

    public void setType(List<String> type) {
        this.type = type;
    }

    public List<Long> getTagId() {
        return tagId == null ? Collections.emptyList() : tagId;
    }

    public void setTagId(List<Long> tagId) {
        this.tagId = tagId;
    }
}
